package com.rk.kbk.dao;

import com.rk.kbk.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

/**
 * @UserDao
 * @用户Dao
 * @version : Ver 1.0
 */
public interface UserDao extends JpaRepository<User, Long>,JpaSpecificationExecutor {

    User findOneByPhone(String phone);

    User findOneByPhoneAndPassword(String username, String password);

    User findOneByPhoneAndIdNot(String username, Long id);

    List<User> findByUserType(Integer userType);

    List<User> findByUserStatus(Integer userStatus);

    List<User> findByUserTypeAndUserStatus(Integer userType,Integer userStatus);

    List<User> findByPhoneLike(String phone);

    List<User> findByUserTypeAndIdLikeOrNickNameLikeOrPhoneLike(Integer userType,Long id, String nickName, String phone);

    List<User> findByUserTypeAndIsRegisterAndUserStatus(Integer userType, Integer isRegister, Integer userStatus);

    List<User>findByNickNameOrRealNameLike(String nickName,String realName);
    List<User> findByNickNameLikeOrRealNameLikeAndUserType(String nickName,String realName,Integer userType);

    List<User> findByUserTypeAndIsRegisterIn(Integer userType,List<Integer> integerList);

    List<User> findByUserTypeAndIsWorkAndIsRegisterAndUserStatusAndServeType(Integer userType,Integer isWork,Integer isRegister,Integer userStatus,Integer serveType);
    /**
     * 根据昵称或者真实姓名查询
     */
    User findByNickNameOrRealName(String nickName,String realName);

    /**
     * 根据id集合获取列表
     */
   List<User> findByIdIn(List<Long> id);
    /**
     * 根据电话和用户类型获取对象
     */
    User findOneByPhoneAndUserTypeIn(String phone,List<Integer> userType);
}
